<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>博客创建——hexo安装 | 沐の空间</title><meta name="keywords" content="hexo"><meta name="author" content="White_mu,WhitemuTeam@outlook.com"><meta name="copyright" content="White_mu"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="下载与安装必备工具 Node.js： 官方网站:https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F; 下载地址:https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;download&#x2F; 淘宝分流:https:&#x2F;&#x2F;npm.taobao.org&#x2F;mirrors&#x2F;node  Git: 官方网站:http:&#x2F;&#x2F;git-scm.com&#x2F; 下载地址:https:&#x2F;&#x2F;git-scm.com&#x2F;download 淘宝分流（Windo">
<meta property="og:type" content="article">
<meta property="og:title" content="博客创建——hexo安装">
<meta property="og:url" content="https://muspace.top/posts/2622/index.html">
<meta property="og:site_name" content="沐の空间">
<meta property="og:description" content="下载与安装必备工具 Node.js： 官方网站:https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F; 下载地址:https:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;download&#x2F; 淘宝分流:https:&#x2F;&#x2F;npm.taobao.org&#x2F;mirrors&#x2F;node  Git: 官方网站:http:&#x2F;&#x2F;git-scm.com&#x2F; 下载地址:https:&#x2F;&#x2F;git-scm.com&#x2F;download 淘宝分流（Windo">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/83061392.png">
<meta property="article:published_time" content="2021-04-23T14:30:00.000Z">
<meta property="article:modified_time" content="2021-07-06T02:00:00.000Z">
<meta property="article:author" content="White_mu">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/83061392.png"><link rel="shortcut icon" href="/img/Oldfavicon.png"><link rel="canonical" href="https://muspace.top/posts/2622/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//www.google-analytics.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script async="async" src="https://www.googletagmanager.com/gtag/js?id=G-ZVRBXJ2DLK"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ZVRBXJ2DLK');
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-07-06 10:00:00'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
          const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
          const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
          const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified

          if (t === undefined) {
            if (isLightMode) activateLightMode()
            else if (isDarkMode) activateDarkMode()
            else if (isNotSpecified || hasNoSupport) {
              const now = new Date()
              const hour = now.getHours()
              const isNight = hour <= 6 || hour >= 18
              isNight ? activateDarkMode() : activateLightMode()
            }
            window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
              if (saveToLocal.get('theme') === undefined) {
                e.matches ? activateDarkMode() : activateLightMode()
              }
            })
          } else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" href="//at.alicdn.com/t/font_2594570_i6c7w02fsw.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"><style>#aside-content .card-info .card-info-social-icons i { position: inherit !important}</style><style>#aside-content .card-info .button--animated i { position: inherit !important}</style><script src="/live2d-widget/autoload.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zyoushuo/Blog@latest/hexo/css/loading_style_1.css" ><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/zyoushuo/Blog@latest/hexo/css/loading_style_2.css" ><script src="/live2d-widget/autoload.js"></script><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hexo-butterfly-artitalk-pro/lib/card.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="沐の空间" type="application/atom+xml">
</head><body>
<div id='loader'>
    
    <div class="outer_box">
    <div class='loader_overlay'></div>
    <div class='loader_cogs'>
        <div class='loader_cogs__top'>
            <div class='top_part'></div>
            <div class='top_part'></div>
            <div class='top_part'></div>
            <div class='top_hole'></div>
        </div>
        <div class='loader_cogs__left'>
            <div class='left_part'></div>
            <div class='left_part'></div>
            <div class='left_part'></div>
            <div class='left_hole'></div>
        </div>
        <div class='loader_cogs__bottom'>
            <div class='bottom_part'></div>
            <div class='bottom_part'></div>
            <div class='bottom_part'></div>
            <div class='bottom_hole'></div>
        </div>
        <p style="text-align:center">&nbsp;&nbsp;&nbsp;loading...</p>
    </div>
    </div>
  
</div>

<script>
  var endLoading = function () {
    document.body.style.overflow = 'auto';
    document.getElementById('loader').classList.add("loading");
  }
  window.addEventListener('load',endLoading);
</script>
<div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="/img/head.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">49</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">20</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">20</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/artitalk/"><i class="fa-fw iconfont icon-sticky-note-line"></i><span> 碎碎念</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa-fw fa fa-book"></i><span> 文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-link"></i><span> 链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/link/"><i class="fa-fw fa fa-users"></i><span> 友情链接</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://space.bilibili.com/97020216"><i class="fa-fw iconfont icon-bilibili-line"></i><span> Bilibili个人主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-list"></i><span> 菜单</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/about/"><i class="fa-fw fa fa-heart"></i><span> 关于</span></a></li><li><a class="site-page" href="/lab/ProgrammersYellowCalender"><i class="fa-fw iconfont icon-calendar-2-line"></i><span> 程序员老黄历</span></a></li><li><a class="site-page" href="/jump/"><i class="fa-fw iconfont icon-web"></i><span> 文章导航</span></a></li></ul></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://travellings.link"><i class="fa-fw fa fa-subway"></i><span> 开往</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/83061392.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">沐の空间</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/artitalk/"><i class="fa-fw iconfont icon-sticky-note-line"></i><span> 碎碎念</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa-fw fa fa-book"></i><span> 文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page" href="/categories/"><i class="fa-fw fa fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page" href="/archives/"><i class="fa-fw fa fa-archive"></i><span> 时间轴</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-link"></i><span> 链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/link/"><i class="fa-fw fa fa-users"></i><span> 友情链接</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://space.bilibili.com/97020216"><i class="fa-fw iconfont icon-bilibili-line"></i><span> Bilibili个人主页</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fa fa-list"></i><span> 菜单</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/about/"><i class="fa-fw fa fa-heart"></i><span> 关于</span></a></li><li><a class="site-page" href="/lab/ProgrammersYellowCalender"><i class="fa-fw iconfont icon-calendar-2-line"></i><span> 程序员老黄历</span></a></li><li><a class="site-page" href="/jump/"><i class="fa-fw iconfont icon-web"></i><span> 文章导航</span></a></li></ul></div><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://travellings.link"><i class="fa-fw fa fa-subway"></i><span> 开往</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">博客创建——hexo安装</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-04-23T14:30:00.000Z" title="发表于 2021-04-23 22:30:00">2021-04-23</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-07-06T02:00:00.000Z" title="更新于 2021-07-06 10:00:00">2021-07-06</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/hexo/">hexo</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">1.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>4分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="下载与安装"><a href="#下载与安装" class="headerlink" title="下载与安装"></a>下载与安装</h1><h2 id="必备工具"><a href="#必备工具" class="headerlink" title="必备工具"></a>必备工具</h2><ol>
<li><p>Node.js：</p>
<p>官方网站:<a target="_blank" rel="noopener" href="https://nodejs.org/en/">https://nodejs.org/en/</a></p>
<p>下载地址:<a target="_blank" rel="noopener" href="https://nodejs.org/en/download/">https://nodejs.org/en/download/</a></p>
<p>淘宝分流:<a target="_blank" rel="noopener" href="https://npm.taobao.org/mirrors/node">https://npm.taobao.org/mirrors/node</a></p>
</li>
<li><p>Git:</p>
<p>官方网站:<a target="_blank" rel="noopener" href="http://git-scm.com/">http://git-scm.com/</a></p>
<p>下载地址:<a target="_blank" rel="noopener" href="https://git-scm.com/download">https://git-scm.com/download</a></p>
<p>淘宝分流（Windows）:<a target="_blank" rel="noopener" href="https://npm.taobao.org/mirrors/git-for-windows/">https://npm.taobao.org/mirrors/git-for-windows/</a></p>
</li>
</ol>
<h2 id="安装hexo"><a href="#安装hexo" class="headerlink" title="安装hexo"></a>安装hexo</h2><p>0*：配置淘宝cnpm管理器（右键打开Git Bash here）（不能使用 Ctrl + C ，右键选择Paste复制）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g cnpm --registry=http://registry.npm.taobao.org</span><br></pre></td></tr></table></figure>

<p>（注意：只复制npm及以后的内容，不需要复制“$”）</p>
<p>1.确定安装hexo的位置（存放博客文件的位置，不需要新建文件夹）</p>
<p>2.在确定安装的位置中右键，点击Git Bash here</p>
<p>3.复制以下代码至弹出的命令行窗口中</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<p>或者：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cnpm install -g hexo-cli</span><br></pre></td></tr></table></figure>

<p>4.创建blog文件夹：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo init &lt;folder&gt; </span><br><span class="line"><span class="built_in">cd</span> &lt;folder&gt;</span><br><span class="line">npm install</span><br></pre></td></tr></table></figure>

<p> “<floder>”为将新建的用于存放hexo文件的文件夹的名字，请更改</p>
<p>自此，hexo已安装完成，以下为配置教程：</p>
<h1 id="配置："><a href="#配置：" class="headerlink" title="配置："></a>配置：</h1><h2 id="常用命令："><a href="#常用命令：" class="headerlink" title="常用命令："></a>常用命令：</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">hexo s <span class="comment">#实时预览blog，在浏览器打开localhost:4000</span></span><br><span class="line">hexo g <span class="comment">#生成blog网页文件</span></span><br><span class="line">hexo d <span class="comment">#部署blog至远程服务器</span></span><br><span class="line">hexo clean <span class="comment">#清理blog网页文件</span></span><br></pre></td></tr></table></figure>

<p>（不需要复制$及以后的内容）</p>
<h2 id="config-yml"><a href="#config-yml" class="headerlink" title="_config.yml"></a>_config.yml</h2><p>位于blog文件夹根目录下的blog配置文件。</p>
<p>官方帮助文档链接：<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/configuration">https://hexo.io/zh-cn/docs/configuration</a></p>
<p>我们通常使用sublime text编辑yml和其他配置文件，下载地址：<a target="_blank" rel="noopener" href="https://www.sublimetext.com/3">下载 - 崇高文本 (sublimetext.com)</a></p>
<h2 id="文章创建："><a href="#文章创建：" class="headerlink" title="文章创建："></a>文章创建：</h2><p>hexo默认使用.md（Markdown）文件进行blog文章创建，通常存放在…\source\ _posts下</p>
<p>我们通常使用Typora来进行对Markdown文件的编辑，下载链接：<a target="_blank" rel="noopener" href="https://typora.io/#download">https://typora.io/#download</a></p>
<h2 id="文章信息编辑（front-matter）："><a href="#文章信息编辑（front-matter）：" class="headerlink" title="文章信息编辑（front-matter）："></a>文章信息编辑（front-matter）：</h2><p>官方帮助文档：<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/front-matter">https://hexo.io/zh-cn/docs/front-matter</a></p>
<h1 id="部署："><a href="#部署：" class="headerlink" title="部署："></a>部署：</h1><h2 id="创建SSH"><a href="#创建SSH" class="headerlink" title="创建SSH:"></a>创建SSH:</h2><p>打开终端，输入（填写你的邮箱）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C <span class="string">&#x27;yourmail@example.com&#x27;</span></span><br></pre></td></tr></table></figure>

<p>然后不断enter即可</p>
<p>在你的用户文件夹下找到.ssh文件夹，找到<code>id_rsa.pub</code>并用记事本打开，里面的内容就是你的SSH密钥</p>
<h2 id="绑定："><a href="#绑定：" class="headerlink" title="绑定："></a>绑定：</h2><p>登录你的Github，并跳转到<a target="_blank" rel="noopener" href="https://github.com/settings/keys">SSH and GPG keys (github.com)</a></p>
<p>点击New SSH key，titlle任取，key中粘贴你的SSH密钥</p>
<p>点击Add SSH key即可</p>
<h2 id="验证："><a href="#验证：" class="headerlink" title="验证："></a>验证：</h2><p>在终端中输入</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh -T git@github.com</span><br></pre></td></tr></table></figure>

<p>若输出：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Are you sure you want to <span class="built_in">continue</span> connecting (yes/no)?</span><br></pre></td></tr></table></figure>

<p>输入yes，输出：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Hi xxx! You<span class="string">&#x27;ve successfully authenticated, but Github does not provide shell access.</span></span><br></pre></td></tr></table></figure>

<p>即成功</p>
<h2 id="部署：-1"><a href="#部署：-1" class="headerlink" title="部署："></a>部署：</h2><p>在终端中输入(npm可改成cnpm)：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<p>并修改<code>_config.yml</code>(hexo根目录)：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="attr">type:</span> <span class="string">git</span></span><br><span class="line">  <span class="attr">repo:</span> <span class="string">&lt;repository</span> <span class="string">url&gt;</span> <span class="comment">#https://bitbucket.org/JohnSmith/johnsmith.bitbucket.io</span></span><br><span class="line">  <span class="attr">branch:</span> <span class="string">master</span></span><br><span class="line">  <span class="attr">message:</span></span><br></pre></td></tr></table></figure>

<p>参考示例，在repo这一行输入你的仓库地址，保存</p>
<p>在终端中输入：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d</span><br></pre></td></tr></table></figure>

<p>开始上传你的blog文件，中途可能需要你输入账号密码，稍等片刻，你的blog就可以部署在远程服务器中</p>
<h1 id="主题使用（butterfly）："><a href="#主题使用（butterfly）：" class="headerlink" title="主题使用（butterfly）："></a>主题使用（butterfly）：</h1><h2 id="下载："><a href="#下载：" class="headerlink" title="下载："></a>下载：</h2><p>在hexo根目录打开git bash，输入以下命令以下载butterfly主题：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> -b master https://gitee.com/iamjerryw/hexo-theme-butterfly.git themes/butterfly</span><br></pre></td></tr></table></figure>

<h2 id="使用："><a href="#使用：" class="headerlink" title="使用："></a>使用：</h2><p>编辑<code>_config.yml</code>（请找到theme而非直接复制粘贴）：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">theme:</span> <span class="string">butterfly</span></span><br></pre></td></tr></table></figure>

<p>然后<code>hexo clean</code>和<code>hexo g</code></p>
<h2 id="配置：-1"><a href="#配置：-1" class="headerlink" title="配置："></a>配置：</h2><p>敬请参阅官方配置文档：<a target="_blank" rel="noopener" href="https://butterfly.js.org/posts/21cfbf15/">Butterfly 安裝文檔(一) 快速開始 | Butterfly</a></p>
<h2 id="添加页面："><a href="#添加页面：" class="headerlink" title="添加页面："></a>添加页面：</h2><p>添加tags页（标签页）和categories页（分类页）和about页（关于）和link页（友情链接）都可使用此方法</p>
<p>以创建tags页为例：</p>
<p>在hexo根目录下打开source文件夹</p>
<p>创建文件夹并命名为tags</p>
<p>在新创建的文件夹中创建index.md文件</p>
<p>在index.md文件中添加以下内容（front-matter）：</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: 标签</span><br><span class="line">date: 2021-01-24 05:26:43</span><br><span class="line">type: &quot;tags&quot;</span><br><span class="line">---</span><br></pre></td></tr></table></figure>

<p>然后执行hexo clean和hexo g即可完成创建</p>
<h1 id="常见问题："><a href="#常见问题：" class="headerlink" title="常见问题："></a>常见问题：</h1><h2 id="hexo-command-not-found-或-cnpm-command-not-found"><a href="#hexo-command-not-found-或-cnpm-command-not-found" class="headerlink" title="hexo: command not found 或 cnpm: command not found"></a>hexo: command not found 或 cnpm: command not found</h2><p>在终端输入以下命令:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-cil -g</span><br></pre></td></tr></table></figure>

<p>或：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g cnpm --registry=http://registry.npm.taobao.org</span><br></pre></td></tr></table></figure>

<p>然后你会看到类似于以下的输出（以安装cnpm为例）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">$ npm install -g cnpm --registry=http://registry.npm.taobao.org</span><br><span class="line">npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142</span><br><span class="line">npm WARN deprecated har-validator@5.1.5: this</span><br><span class="line">C:\Users\沐沐\AppData\Roaming\npm\cnpm -&gt; C:\Users\沐沐\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm</span><br><span class="line">+ cnpm@6.2.0</span><br><span class="line">updated 1 package <span class="keyword">in</span> 80.744s</span><br></pre></td></tr></table></figure>

<p>此时复制”-&gt;”后的内容（但不要复制bin后面的内容），</p>
<p>也就是：C:\Users\沐沐\AppData\Roaming\npm\node_modules\cnpm\bin</p>
<p>依次打开设置-&gt;系统-&gt;关于-&gt;高级系统设置-&gt;环境变量</p>
<p>在”…的用户变量”下方找到<code>Path</code>变量，双击<code>Path</code>变量进入编辑界面，点击新建，粘贴你刚才复制的内容，回车并点击确定即可</p>
<h2 id="如何在右键快捷菜单的新建选项中添加Markdown选项"><a href="#如何在右键快捷菜单的新建选项中添加Markdown选项" class="headerlink" title="如何在右键快捷菜单的新建选项中添加Markdown选项"></a>如何在右键快捷菜单的新建选项中添加Markdown选项</h2><p>敬请参阅：<a target="_blank" rel="noopener" href="https://www.cnblogs.com/zhiyin1209/p/12149784.html">Win10系统下鼠标右键新建Markdown文档 - 知音12138 - 博客园 (cnblogs.com)</a></p>
<h2 id="Git提交时提示‘The-file-will-have-its-original-line-endings-in-your-working-directory’"><a href="#Git提交时提示‘The-file-will-have-its-original-line-endings-in-your-working-directory’" class="headerlink" title="Git提交时提示‘The file will have its original line endings in your working directory’"></a>Git提交时提示‘The file will have its original line endings in your working directory’</h2><p>在终端中输入：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git config --global core.autocrlf  <span class="literal">false</span></span><br></pre></td></tr></table></figure>

<p>即可解决</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:WhitemuTeam@outlook.com">White_mu</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://muspace.top/posts/2622/">https://muspace.top/posts/2622/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://muspace.top" target="_blank">沐の空间</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/hexo/">hexo</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/83061392.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/WeChat.png" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/WeChat.png" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/alipay.png" target="_blank"><img class="post-qr-code-img" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/alipay.png" alt="alipay"/></a><div class="post-qr-code-desc">alipay</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/10260/"><img class="prev-cover" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/86800103.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">沐の空间更新计划</div></div></a></div><div class="next-post pull-right"><a href="/posts/44969/"><img class="next-cover" src="https://cdn.jsdelivr.net/gh/WhitemuTeam/web-img/img/65897535.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">更新日志（v.1.0）</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="waline-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD%E4%B8%8E%E5%AE%89%E8%A3%85"><span class="toc-number">1.</span> <span class="toc-text">下载与安装</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BF%85%E5%A4%87%E5%B7%A5%E5%85%B7"><span class="toc-number">1.1.</span> <span class="toc-text">必备工具</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85hexo"><span class="toc-number">1.2.</span> <span class="toc-text">安装hexo</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%EF%BC%9A"><span class="toc-number">2.</span> <span class="toc-text">配置：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%EF%BC%9A"><span class="toc-number">2.1.</span> <span class="toc-text">常用命令：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#config-yml"><span class="toc-number">2.2.</span> <span class="toc-text">_config.yml</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E7%AB%A0%E5%88%9B%E5%BB%BA%EF%BC%9A"><span class="toc-number">2.3.</span> <span class="toc-text">文章创建：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%87%E7%AB%A0%E4%BF%A1%E6%81%AF%E7%BC%96%E8%BE%91%EF%BC%88front-matter%EF%BC%89%EF%BC%9A"><span class="toc-number">2.4.</span> <span class="toc-text">文章信息编辑（front-matter）：</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E9%83%A8%E7%BD%B2%EF%BC%9A"><span class="toc-number">3.</span> <span class="toc-text">部署：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9B%E5%BB%BASSH"><span class="toc-number">3.1.</span> <span class="toc-text">创建SSH:</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BB%91%E5%AE%9A%EF%BC%9A"><span class="toc-number">3.2.</span> <span class="toc-text">绑定：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%AA%8C%E8%AF%81%EF%BC%9A"><span class="toc-number">3.3.</span> <span class="toc-text">验证：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%83%A8%E7%BD%B2%EF%BC%9A-1"><span class="toc-number">3.4.</span> <span class="toc-text">部署：</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%BB%E9%A2%98%E4%BD%BF%E7%94%A8%EF%BC%88butterfly%EF%BC%89%EF%BC%9A"><span class="toc-number">4.</span> <span class="toc-text">主题使用（butterfly）：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD%EF%BC%9A"><span class="toc-number">4.1.</span> <span class="toc-text">下载：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%EF%BC%9A"><span class="toc-number">4.2.</span> <span class="toc-text">使用：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%EF%BC%9A-1"><span class="toc-number">4.3.</span> <span class="toc-text">配置：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0%E9%A1%B5%E9%9D%A2%EF%BC%9A"><span class="toc-number">4.4.</span> <span class="toc-text">添加页面：</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%EF%BC%9A"><span class="toc-number">5.</span> <span class="toc-text">常见问题：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#hexo-command-not-found-%E6%88%96-cnpm-command-not-found"><span class="toc-number">5.1.</span> <span class="toc-text">hexo: command not found 或 cnpm: command not found</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A6%82%E4%BD%95%E5%9C%A8%E5%8F%B3%E9%94%AE%E5%BF%AB%E6%8D%B7%E8%8F%9C%E5%8D%95%E7%9A%84%E6%96%B0%E5%BB%BA%E9%80%89%E9%A1%B9%E4%B8%AD%E6%B7%BB%E5%8A%A0Markdown%E9%80%89%E9%A1%B9"><span class="toc-number">5.2.</span> <span class="toc-text">如何在右键快捷菜单的新建选项中添加Markdown选项</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Git%E6%8F%90%E4%BA%A4%E6%97%B6%E6%8F%90%E7%A4%BA%E2%80%98The-file-will-have-its-original-line-endings-in-your-working-directory%E2%80%99"><span class="toc-number">5.3.</span> <span class="toc-text">Git提交时提示‘The file will have its original line endings in your working directory’</span></a></li></ol></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By White_mu</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">单程孤舟，出云入霞，如歌如吟。</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function loadWaline () {
  function initWaline () {
    let initData = {
      el: '#waline-wrap',
      serverURL: 'https://mywaline-kohl.vercel.app',
      avatar: 'monsterid',
      path: location.pathname,
      emojiCDN: 'https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili',
      emojiMaps: "",
    }
    
    if (true) {
      const otherData = {"langMode":{"admin":"沐沐"},"dark":"auto","emoji":["https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/bilibili","https://cdn.jsdelivr.net/gh/walinejs/emojis@1.0.0/weibo"]}
      initData = Object.assign(initData, otherData)
    }
    
    const waline = new Waline(initData)
  }

  if (typeof Waline === 'function') initWaline() 
  else getScript('https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js').then(initWaline)
}

if ('Waline' === 'Waline' || !false) {
  if (false) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
  else setTimeout(loadWaline, 0)
} else {
  function loadOtherComment () {
    loadWaline()
  }
}</script></div><link rel="stylesheet" href="/css/muspace.css"><script async data-pjax src="/js/randombg.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>
  function card_artitalk_injector_config(){
    var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
    var item_html = '<div class="card-widget card-shuo"><div class="card-content" style="height:auto;min-height:280px;"><div class="item-headline"><i class="fas fa-comments"></i><span><a href="/artitalk/" title="artitalk page link">碎碎念</a></span><a id="cardVisual" style="cursor:pointer;float:right" onclick="cardVisual()">编辑</a></div><div id="artitalk_main" style="width:100%;height:100%;padding:1px"></div></div></div>';
    console.log('已挂载card_artitalk');
    parent_div_git.insertAdjacentHTML("afterbegin",item_html);
    (()=>{
      const init = () => {
        new Artitalk(Object.assign({
          appId: '0Iwjb3hh2nIyE2rXULy07JJI-MdYXbMMI',
          appKey: 'WJl1nKnTBO8oq4OhD50MRYBX',
        }, {"serverURL":"https://0iwjb3hh.api.lncldglobal.com","lang":"zh","pageSize":1,"color1":"#49b1f5","color2":"#00c4b6","atEmoji":{"Mafumafu1":"https://cdn.jsdelivr.net/gh/GamerNoTitle/ValineCDN@master/Mafumafu/199749454.png","Mafumafu2":"https://cdn.jsdelivr.net/gh/GamerNoTitle/ValineCDN@master/Mafumafu/199749455.png"}} ))
      }
      if (typeof Artitalk === 'function') {
        init()
      } else {
        getScript('https://cdn.jsdelivr.net/npm/artitalk').then(init)
      }
    })()
    }
  var elist = '/artitalk/,/posts/'.split(',');
  var cpage = location.pathname;
  var epage = 'all';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    card_artitalk_injector_config();
  }
  else if (epage === cpage){
    card_artitalk_injector_config();
  }
  </script><script async src="https://cdn.jsdelivr.net/npm/hexo-butterfly-artitalk-pro/lib/card_visual.js"></script><!-- hexo injector body_end end --></body></html>